﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace ConsoleApplication1
{
    /// <summary>
    /// 该类的实例可跨越AppDomain的边界“按值封送”
    /// </summary>
    [Serializable]
    public sealed class MarshalByValType : Object
    {
        private DateTime m_createonTime = DateTime.Now;
        
        public MarshalByValType()
        {
            Console.WriteLine("{0} ctor running in {1},Created on {2:D}", this.GetType().ToString(), Thread.GetDomain().FriendlyName, m_createonTime);
        }

        public override String ToString()
        {
            return m_createonTime.ToLongDateString();
        }
    }
}
